package comprehensive_case;

import java.util.Scanner;

public class 卖飞机票函数形式 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入机票的价格：");
        int money = sc.nextInt();
        System.out.println("请输入当前月份：");
        int mouth = sc.nextInt();
        System.out.println("请输入仓位0经济舱 1头等舱");
        int seat = sc.nextInt();

        if (mouth >= 5 && mouth <= 10) {
            // 旺季
            money = getprice(money, seat, 0.9, 0.85);
        } else if ((mouth >= 1 && mouth <= 4) || (mouth >= 11 && mouth <= 12)) {
            // 淡季
            money = getprice(money, seat, 0.65, 0.7);
        } else {
            System.out.println("没有这个月份");
        }

        System.out.println(money);
        sc.close();
    }

    public static int getprice(int money, int seat, double discount0, double discount1) {
        // 淡季
        if (seat == 0) {
            money = (int) (money * discount0);
        } else if (seat == 1) {
            money = (int) (money * discount1);
        } else {
            System.out.println("没有这个仓位");
        }
        return money;
    }
}
